package com.ncmmall.application.jobs;

import com.ncmmall.application.business.member.MemberApplication;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * 自动取消分销临时上下级关系
 *
 * @author likaikai
 * @date 2020-09-22 18:00:24
 */
@Slf4j
public class AutoCancelFatherApplication extends QuartzJobBean {

    private final MemberApplication memberApplication;

    public AutoCancelFatherApplication(MemberApplication memberApplication) {
        this.memberApplication = memberApplication;
    }

    public void execute() {
        try {
            log.info("取消分销上下级关系开始");
            memberApplication.removeFather();
            log.info("取消分销上下级关系完成");
        } catch (Exception e) {
            log.error("自动取消分销上下级关系异常", e);
        }
    }


    @Override
    protected void executeInternal(JobExecutionContext context) {

    }
}
